package com.sky.service.impl;

import com.sky.service.ShopService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class ShopServiceImpl implements ShopService {
    @Autowired
    RedisTemplate redisTemplate;


    @Override
    public void modifyShopStatus(Integer status) {
        ValueOperations valueOperations = redisTemplate.opsForValue();
        valueOperations.set("shopStatus",status);
        log.info("店铺状态：{}",valueOperations.get("shopStatus"));
    }

    @Override
    public Integer getShopStatus() {
        ValueOperations valueOperations = redisTemplate.opsForValue();
        Integer status = (Integer)valueOperations.get("shopStatus");
        return status;
    }
}
